<?php
/*
 * @Author: an
 * @Date: 2021/12/21
 * @Description: 测试专用
 */


namespace App\Http\Controllers\WebApi;


use App\Jobs\SynUser;
use App\Models\ImGroup;
use App\Models\ImGroupUser;
use App\Models\ImUsers;
use App\Services\Aliyun\Identify\IdCard;
use App\Services\Aliyun\upload\AliyunUploadServices;
use App\Services\Gaode\GaoDeService;
use App\Services\SevenCattle\UploadServices;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Monolog\Formatter\JsonFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Monolog\Processor\ProcessIdProcessor;
use Monolog\Processor\UidProcessor;

class TestController
{
    //测试主方法
    public function goTest(Request $request)
    {
//        $data = now()->addSeconds(3);
//        SynUser::dispatch('test')->delay($data);
//        $this->dgTest();
//        $this->idCard();
//        $this->aliUpload();
//        $c = new UploadServices();
    }

    public function dgTest()
    {
        $gd = new GaoDeService();
        $data1 = '广东省深圳市南山区深圳西站';
        $data2 = '27.38.196.15';
        $res1 = $gd->getAddressLocation($data1);
        $res2 = $gd->beIpGetLocation($data2);
        Log::info('高德---', [$res1]);
        Log::info('高德---', [$res2]);
    }

    public function idCard()
    {
        $ic = new IdCard();
        $param1 = '350623199';
        $param2 = 'hello world';
        $data1 = $ic->checkNoName($param1, $param2);
        Log::info('身份识别---', [$ic->getMessage()]);
    }

    public function aliUpload()
    {
        $upload = new AliyunUploadServices();
        $etag = '6C792A92CBDD40D1EFAE573012ADF185';
        $url = 'http://uploadpublicbuckets.oss-cn-hangzhou.aliyuncs.com/tangfen/20211228/2021122817002561cad2297d626.png';
//        $url = $upload->downloadImg($url);
//        $data = $upload->downloadImg($url);
        $data = $upload->getUploadInformation($url);
        Log::info('文件上传---', [$data]);
    }
}
